<template>
	<view class="my_table">
		<view v-if="type == 0">
			<uni-table ref="table" :loading="loading" border stripe  emptyText="暂无更多数据">
				<uni-tr>
					<!-- <uni-th width="50" align="center">设备名称</uni-th> -->
					<uni-th width="50" align="center">A相</uni-th>
					<uni-th width="50" align="center">B相</uni-th>
					<uni-th width="50" align="center">C相</uni-th>
					<uni-th width="50" align="center">总电流</uni-th>
					<uni-th width="100" align="center">电池电压 </uni-th>
					<uni-th width="100" align="center">GPS信号</uni-th>
					<uni-th width="140" align="center">时间</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<!-- <uni-td align="center">{{ item.name }}</uni-td> -->
					<uni-td align="center">{{ item.aphaseValue }}</uni-td>
					<uni-td align="center">{{ item.bphaseValue }}</uni-td>
					<uni-td align="center">{{ item.cphaseValue }}</uni-td>
					<uni-td align="center">{{ item.totalPhase }}</uni-td>
					<uni-td align="center">{{ item.batteryVolt }}</uni-td>
					<uni-td align="center">{{ item.gprsSignalStrength }}</uni-td>
					<uni-td align="center">{{ item.dateTime }}</uni-td>
				</uni-tr>
			</uni-table>
		</view>
		<view v-if="type == 11">
			<uni-table ref="table" :loading="loading" border stripe  emptyText="暂无更多数据">
				<uni-tr>
					<!-- <uni-th width="50" align="center">设备名称</uni-th> -->
					<uni-th width="100" align="center">A接头温度</uni-th>
					<uni-th width="100" align="center">B接头温度</uni-th>
					<uni-th width="100" align="center">C接头温度</uni-th>
					<uni-th width="140" align="center">时间</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<!-- <uni-td align="center">{{ item.name }}</uni-td> -->
					<uni-td align="center">{{ item.aphaseJointTemp }}</uni-td>
					<uni-td align="center">{{ item.bphaseJointTemp }}</uni-td>
					<uni-td align="center">{{ item.cphaseJointTemp }}</uni-td>
					<uni-td align="center">{{ item.dateTime }}</uni-td>
				</uni-tr>
			</uni-table>
		</view>
		<view v-if="type == 8">
			<uni-table ref="table" :loading="loading" border stripe  emptyText="暂无更多数据">
				<uni-tr>
					<!-- <uni-th width="50" align="center">设备名称</uni-th> -->
					<uni-th width="50" align="center">X轴振动</uni-th>
					<uni-th width="50" align="center">Y轴振动</uni-th>
					<uni-th width="50" align="center">Z轴振动</uni-th>
					<uni-th width="80" align="center">信号强度</uni-th>
					<uni-th width="80" align="center">电池电压</uni-th>
					<uni-th width="140" align="center">时间</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<!-- <uni-td align="center">{{ item.name }}</uni-td> -->
					<uni-td align="center">{{ item.xdirectionStrength }}</uni-td>
					<uni-td align="center">{{ item.ydirectionStrength }}</uni-td>
					<uni-td align="center">{{ item.zdirectionStrength }}</uni-td>
					<uni-td align="center">{{ item.signalIntensity }}</uni-td>
					<uni-td align="center">{{ item.batteryVoltage }}</uni-td>
					<uni-td align="center">{{ item.dateTime }}</uni-td>
				</uni-tr>
			</uni-table>
		</view>
		<view v-if="type == 10">
			<uni-table ref="table" :loading="loading" border stripe  emptyText="暂无更多数据">
				<uni-tr>
					<!-- <uni-th width="50" align="center">设备名称</uni-th> -->
					<uni-th width="50" align="center">X振动量</uni-th>
					<uni-th width="50" align="center">Y振动量</uni-th>
					<uni-th width="50" align="center">Z振动量</uni-th>
					<uni-th width="140" align="center">时间</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<!-- <uni-td align="center">{{ item.name }}</uni-td> -->
					<uni-td align="center">{{ item.xdirectionVibration }}</uni-td>
					<uni-td align="center">{{ item.ydirectionVibration }}</uni-td>
					<uni-td align="center">{{ item.zdirectionVibration }}</uni-td>
					<uni-td align="center">{{ item.dateTime }}</uni-td>
				</uni-tr>
			</uni-table>
		</view>
		<view v-if="type == 6">
			<uni-table ref="table" :loading="loading" border stripe  emptyText="暂无更多数据">
				<uni-tr>
					<!-- <uni-th width="50" align="center">设备名称</uni-th> -->
					<uni-th width="80" align="center">A相最大放电量</uni-th>
					<uni-th width="80" align="center">A相最大放电频次</uni-th>
					<uni-th width="80" align="center">B相最大放电量</uni-th>
					<uni-th width="80" align="center">B相最大放电频次</uni-th>
					<uni-th width="80" align="center">C相最大放电量</uni-th>
					<uni-th width="80" align="center">C相最大放电频次</uni-th>
					<uni-th width="140" align="center">数据时间</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<!-- <uni-td align="center">{{ item.name }}</uni-td> -->
					<uni-td align="center">{{ item.aphaseMaxElectric}}</uni-td>
					<uni-td align="center">{{ item.aphaseMaxFrequency }}</uni-td>
					<uni-td align="center">{{ item.bphaseMaxElectric }}</uni-td>
					<uni-td align="center">{{ item.bphaseMaxFrequency }}</uni-td>
					<uni-td align="center">{{ item.cphaseMaxElectric }}</uni-td>
					<uni-td align="center">{{ item.cphaseMaxFrequency }}</uni-td>
					<uni-td align="center">{{ item.dateTime }}</uni-td>
				</uni-tr>
			</uni-table>
		</view>
		<view v-if="type == 21">
			<uni-table ref="table" :loading="loading" border stripe  emptyText="暂无更多数据">
				<uni-tr>
					<!-- <uni-th width="50" align="center">设备名称</uni-th> -->
					<uni-th width="80" align="center">电量</uni-th>
					<uni-th width="80" align="center">充电状态</uni-th>
					<uni-th width="80" align="center">振动状态</uni-th>
					<uni-th width="140" align="center">采集时间</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<!-- <uni-td align="center">{{ item.name }}</uni-td> -->
					<uni-td align="center">{{ item.electricQuantity }}</uni-td>
					<uni-td align="center">{{ item.status=='1'?'充电':'不充电' }}</uni-td>
					<uni-td align="center">{{ item.vibration=='1'?'振动':'不振动' }}</uni-td>
					<uni-td align="center">{{ item.createTime }}</uni-td>
				</uni-tr>
			</uni-table>
		</view>
	</view>
</template>

<script>
	import {
	  unCheckedStatus,
	  halfCheckedStatus,
	  isCheckedStatus,
	  deepClone,
	  getAllNodeKeys,
	  getAllNodes,
	  logError,
	  isArray,
	  isString,
	  isNumber,
	  isFunction,
	} from './utils'
	export default {
		name: 'Table',
		props: {
			tableData: {
				type: Array,
				default: () => [],
			},
			loading:{
				type: Boolean,
				default: false,
			},
			type:{
				type:Number/String,
				default:"0"
			}
		},
		data() {
			return {
				/** 原始的树数据 */
				dataRef: [],
				productType:[ //检测设备类型
					  {
					        value: '0',
					        label: '环流监测',
					    },
					    {
					        value: '6',
					        label: '外置局放',
					    },
					    {
					        value: '8',
					        label: '地钉',
					    },
					    {
					        value: '10',
					        label: '故障报警器',
					    },
					    {
					        value: '11',
					        label: '接头感应',
					    },
						{
						    value: '21',
						    label: '启停装置',
						},
				],
				// 每页数据量
				// pageSize: 10,
				// tableData: [],
				// // 当前页
				// pageCurrent: 1,
				// // 数据总量
				// total: 0,
				// loading: false
			}
		},
		watch: {
			tableData(newVal, oldVal) {
				console.log('newVal:', newVal);
				console.log('oldVal:', oldVal);
				if (newVal && newVal.someProperty) {
					console.log(newVal.someProperty);
				} else {
					console.log('someData is not fully defined');
				}
			},
		},
		onReady() {
			console.log(data)
		},
		onShow() {
			console.log(data)
		},
		methods: {
		// 分页触发
				// change(e) {
				// 	this.selectedIndexs.length = 0
				// 	this.$emit('changePage',e.current)
				// },

		}
	}
</script>

<style lang="scss" scoped>
	@import '@/assets/styles/global.scss';

	.my_table {}
</style>